<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" +request.getServerPort() + path + "/";
%>
<head>
	<link type="text/css" rel="stylesheet" href="<%=basePath%>css/style.css" />
	<script type="text/javascript" src="<%=basePath%>scripts/jquery-1.8.3.min.js"></script>
	<script type="text/javascript" src="<%=basePath%>scripts/jquery-3.2.1.js"></script>
	<script type="text/javascript" src="<%=basePath%>scripts/function.js"></script>
</head>
<html>
	<body>
	<div class="main">
		<div class="manage">
			<form action="<%=basePath %>ReplyDeleteModifyMessage_Servlet">
				<table class="form">
					<tr>
						<td class="field">留言编号：</td>
						<td><%=request.getParameter("id") %></td>
					</tr>
					<tr>
						<td class="field">留言者ID：</td>
						<td><%=request.getParameter("user") %></td>
					</tr>
					<tr>
						<td class="field">修改评价内容：</td>
						<td><textarea name="replyContent" id="judgeContent"></textarea></td>
					</tr>
					<tr>
						<td><textarea style="display:none"  name="leaving_id"  ><%=request.getParameter("id")%></textarea><textarea style="display:none"  name="manage"  >modify</textarea></td>
					
						<td><label class="ui-blue"><button  id="submit" >修改</button></label></td>
					</tr>
				</table>
			</form>
		</div>
	</div>
	</body>
</html>
<script type="text/javascript">
	$(function(){
			$(".manage_navbar").removeClass("current");
			$(".guestbook_jsp").addClass("current");
	});
	/* 传递修改评价信息 */
	$("#submit").on("click",function(){
		/* js中使用EL表达式 */
		var judId = '${jb.list[0].judId}';
		var judContent = $("#judgeContent").val();
		$.ajax({
			url : "JudgeServlet",
			type : "post",
			data : {
				action : "updateJudge",
				judgeId : judId,
				judgeContent : judContent
			},
			dataType : "json",
			success : function(data) {
				var msg = data.mesg;
				console.log("消息是："+msg)
				if(msg=="success"){
					alert("修改成功");
					var index = parent.layer.getFrameIndex(window.name);
					parent.layer.close(index); 
				}else{
					alert("修改评价失败");
				}
			
			}
		});
	})
</script>